# Maintainer: Renato Silva <br.renatosilva@gmail.com>

_realname='purple-skypeweb'
pkgbase="mingw-w64-${_realname}-git"
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}-git"
pkgver=r915.922ca95
pkgrel=1
pkgdesc='Skype plugin for libpurple (mingw-w64)'
url='https://github.com/EionRobb/skype4pidgin/tree/master/skypeweb'
license=(GPL3+)
arch=('any')

options=(!libtool strip staticlibs)
source=('git+https://github.com/EionRobb/skype4pidgin'
        Makefile)
sha256sums=('SKIP'
            '660ed7291f336f2fd80a9f3599630b4e700346f8067cc23fab5c0837edf5cf7a')
conflicts=(${MINGW_PACKAGE_PREFIX}-${_realname})
provides=(${MINGW_PACKAGE_PREFIX}-${_realname})
depends=(${MINGW_PACKAGE_PREFIX}-libpurple
         ${MINGW_PACKAGE_PREFIX}-json-glib
         ${MINGW_PACKAGE_PREFIX}-glib2
         ${MINGW_PACKAGE_PREFIX}-zlib
         ${MINGW_PACKAGE_PREFIX}-gettext
         ${MINGW_PACKAGE_PREFIX}-gcc-libs)
makedepends=(${MINGW_PACKAGE_PREFIX}-gcc
             ${MINGW_PACKAGE_PREFIX}-pkg-config
             rsync git)

pkgver() {
    cd "${srcdir}/skype4pidgin"
    printf "r%s.%s" $(git rev-list --count HEAD) $(git rev-parse --short HEAD)
}

prepare() {
    cd "${srcdir}"
    mv Makefile skype4pidgin/skypeweb
}

build() {
    msg2 'Synchronizing build directory'
    rsync --recursive --times "${srcdir}/skype4pidgin/skypeweb"/* "${srcdir}/${_realname}.build.${CARCH}"
    cd "${srcdir}/${_realname}.build.${CARCH}"
    make
}

package() {
    cd "${srcdir}/${_realname}.build.${CARCH}"
    make DESTDIR="${pkgdir}" install
    install -Dm644 "${srcdir}/skype4pidgin/skypeweb/gpl3.txt" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/gpl3.txt"
}
